home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / gui / gui4cli.lha / Gui4Cli / Gui4Cli.gc < prev    next >
Text File  |  1999-04-21  |  17KB  |  690 lines

  1. G4C
  2.  
  3. ; Gui4Cli.gc
  4. ; =================================================================
  5. ; This is the gui which is opened when you click the "Prefs" button 
  6. ; on the Gui4Cli requester. 
  7.  
  8. ; If you find yourself feeling queezy after having suffered the full
  9. ; effect of it's poping open at you unwarned, you may change it as 
  10. ; you see fit..   - set TABs to 3 -
  11.  
  12.  
  13. WINBIG 227 26 299 201 "Gui4Cli"
  14. WinType 11110001
  15.  
  16. BOX 0 0 297 201 out button
  17.  
  18. ; -----------------------------------------------------------------
  19. ;        System events
  20. ; -----------------------------------------------------------------
  21.  
  22. xOnLoad
  23.     setgadvalues gui4cli.gc        ; set default values
  24.     path = $$G4C.editor            ; update path shown
  25.     update #this 84 $path
  26.     sndfx = $*SNDGAD                ; update sound fx shown
  27.     update #this 89 $sndfx
  28.     setgad gui4cli.gc 72 off
  29.     mode = GUI
  30.     setgad #this 903 hide ; palette lv
  31.     palette = 0
  32.     lvhelp = 'Choose guis to load'
  33.     oldguidir = GUIs:
  34.     update gui4cli.gc 50 'Port: $$g4c.port'
  35.     gosub gui4cli.gc SetGuiStat ; starting state
  36.     guiopen Gui4Cli.gc
  37.  
  38. xonreload
  39.     guiopen Gui4Cli.gc
  40.     guiscreen gui4cli.gc front
  41.  
  42. xOnOpen
  43.     SetGad Gui4Cli.gc 1 OFF        ; remove the appicon
  44.     if $mode = LOAD            ; refresh stuff..
  45.        lvuse Gui4Cli.gc 10
  46.        lvdir refresh
  47.     elseif $mode = GUI
  48.        lvuse Gui4Cli.gc 54
  49.        lvdir #env:$$g4c.port
  50.     endif
  51.  
  52. xOnClose 
  53.     SetGad Gui4Cli.gc 1 ON        ; open the appicon
  54.  
  55. xOnFail
  56.     ezreq "Failed.." OK ""
  57.  
  58. xAppIcon 0 0 GUIs:Gui4Cli "Gui4Cli" apivar OFF
  59.     GadID 1
  60.     GuiOpen Gui4Cli.gc
  61.     GuiScreen Gui4Cli.gc FRONT
  62.     if $apivar > ' '
  63.     andifexists DIRECTORY $apivar    ; if a directory or volume icon was
  64.     orifexists DOS $apivar        ; dropped on the icon,
  65.         lvuse Gui4Cli.gc 10        ; we cd to it.. 
  66.         lvdir #$apivar
  67.     endif
  68.  
  69. ; ****** ENABLE THIS HOT KEY IF YOU WANT IT ******
  70. ; xHotKey "rawkey shift f1" ON    ; popup key for this gui
  71. ;    guiopen #this
  72. ;    guiscreen #this front
  73. ;    guiwindow #this front
  74.  
  75. ; -----------------------------------------------------------------
  76. ;        Mode CYCLER
  77. ;        - will rotate gui through all modes
  78. ; -----------------------------------------------------------------
  79.  
  80. XBUTTON 9 5 80 14 "Guis"
  81.     gadid 801
  82.     gadhelp '- List of loaded Guis'
  83.     gosub #this SetGuiStat    ; because it's also called from xOnLoad
  84.  
  85. xRoutine SetguiStat
  86.     mode = GUI
  87.     setgad gui4cli.gc 10 HIDE    ; the listview
  88.     setgad gui4cli.gc 50/59 SHOW    ; other lv & Open/close/quit etc
  89.     setgad gui4cli.gc 60/100 HIDE
  90.     lvuse Gui4Cli.gc 54
  91.     lvdir #env:$$g4c.port
  92.     setwintitle gui4cli.gc 'Port $$g4c.port : Home'
  93.     changearg #this 801 3 16
  94.     changearg #this 802 3 14
  95.     changearg #this 803 3 14
  96.     partredraw gui4cli.gc 4 17 291 181
  97.  
  98. XBUTTON 90 5 80 14 "Load"
  99.     gadhelp '- Load Guis'
  100.     gadid 802
  101.     mode = LOAD
  102.     setgad gui4cli.gc 10 SHOW
  103.     setgad gui4cli.gc 50/58 HIDE
  104.     setgad gui4cli.gc 59 SHOW
  105.     setgad gui4cli.gc 60/79 SHOW
  106.     setgad gui4cli.gc 80/100 HIDE
  107.     lvhelp = 'Choose guis from here'
  108.     setwintitle gui4cli.gc '$oldguidir'
  109.     changearg #this 801 3 14
  110.     changearg #this 802 3 16
  111.     changearg #this 803 3 14
  112.     partredraw gui4cli.gc 4 17 291 181
  113.  
  114. XBUTTON 171 5 80 16 "Prefs"
  115.     gadhelp '- Set general preferences'
  116.     gadid 803
  117.     mode = SET
  118.     setgad gui4cli.gc 10 HIDE
  119.     setgad gui4cli.gc 50/79 HIDE
  120.     setgad gui4cli.gc 80/89 SHOW
  121.     ; reset tab and grid
  122.     update #this 87 $$g4c.tab
  123.     update #this 86 $$g4c.grid
  124.     setwintitle gui4cli.gc 'Gui4Cli settings'
  125.     changearg #this 801 3 14
  126.     changearg #this 802 3 14
  127.     changearg #this 803 3 16
  128.     partredraw gui4cli.gc 4 17 291 181
  129.  
  130.  
  131. ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  132. ; -----------------------------------------------------------------
  133. ;        GUI mode
  134. ;        Open, Close, unload GUIs...
  135. ; -----------------------------------------------------------------
  136. ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  137.  
  138. ; ------ The listview
  139.  
  140. XLISTVIEW 6 66 285 132 "" guivar '' 0 DIR
  141.     gadid 54
  142.     gadfont #mono 8 000
  143.     gadhelp 'These are the guis currently loaded'
  144.     extract guivar file fname
  145.     guiopen $fname
  146.  
  147. TEXT 105 25 174 15 port 35 BOX
  148.     gadid 50
  149.  
  150. XBUTTON 15 45 20 14 "R"        ; refresh list
  151.     gadid 51
  152.     gadhelp 'Refreshes the list of loaded guis'
  153.     lvuse Gui4Cli.gc 54
  154.     lvdir refresh
  155.  
  156. XBUTTON 40 45 58 14 Open
  157.     gadid 51
  158.     gadhelp 'Will open the selected guis'
  159.     lvuse Gui4Cli.gc 54
  160.     lvmulti first
  161.     while $guivar > ''
  162.         extract guivar file fname
  163.         guiopen $fname
  164.         lvmulti next
  165.     endwhile
  166.     lvdir none
  167.  
  168. XBUTTON 100 45 58 14 Close
  169.     gadid 52
  170.     gadhelp 'Will close the selected guis'
  171.     lvuse Gui4Cli.gc 54
  172.     lvmulti first
  173.     while $guivar > ''
  174.         extract guivar file fname
  175.         guiclose $fname
  176.         lvmulti next
  177.     endwhile
  178.     lvdir none
  179.  
  180. XBUTTON 160 45 58 14 Unload
  181.     gadid 53
  182.     gadhelp 'Will quit the selected guis'
  183.     lvuse Gui4Cli.gc 54
  184.     lvmulti first
  185.     while $guivar > ''
  186.         extract guivar file fname
  187.         guiquit $fname
  188.         lvmulti next
  189.     endwhile
  190.     ; the guis won't actually quit until all commands have executed, so..
  191.     reflag = 1
  192.  
  193. xAfter
  194.     if $reflag = 1
  195.        reflag = 0
  196.        lvdir refresh
  197.     endif
  198.  
  199. XBUTTON 235 45 20 14 "A"  ; also shown in gui mode
  200.     gadhelp 'Select all items'
  201.     gadid 51
  202.     lvuse Gui4Cli.gc 54
  203.     lvdir all
  204.  
  205. XBUTTON 255 45 20 14 "N"
  206.     gadhelp 'Unselect all items'
  207.     gadid 51
  208.     lvuse Gui4Cli.gc 54
  209.     lvdir none
  210.  
  211. BOX 6 20 284 44 in button
  212.     GADID 59
  213.  
  214. CTEXT 18 27 'GUI Control' #screen 8 2 0 0001
  215.     gadid 50
  216.  
  217.  
  218. ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  219. ; -----------------------------------------------------------------
  220. ;        LOAD mode
  221. ;        Load GUIs...
  222. ; -----------------------------------------------------------------
  223. ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  224.  
  225. XLISTVIEW 6 66 285 132 "" guivar GUIs: 0 DIR
  226.     gadid 10
  227.     gadfont #mono 8 000
  228.     gadhelp 'Listview : $lvhelp'    ; we set it above according to mode
  229.     docase $mode
  230.       case = FAV
  231.         setgad gui4cli.gc 71 on        ; if double clicked in FAV mode
  232.         setgad gui4cli.gc 60/63 on    ; set it back to LOAD mode
  233.         setgad gui4cli.gc 72 off    ; and cd to selection
  234.         lvhelp = 'Choose guis to load'
  235.         lvmode DIR
  236.         lvdir #$guivar
  237.         mode = LOAD
  238.         break
  239.       case = LOAD
  240.         if $guivar H= G4C
  241.             guiload $guivar
  242.         endif
  243.         break
  244.     endcase
  245.     
  246. xlvdirhook 10
  247.     if $mode = LOAD
  248.         oldguidir = $$lv.dir
  249.         setwintitle gui4cli.gc '$oldguidir'
  250.     endif
  251.  
  252. ; ----- for the box use the same as above (gadid 59)
  253.  
  254. CTEXT 20 27 GuiLoad #screen 8 2 0 0001
  255.     gadid 60
  256.  
  257. XBUTTON 24 42 80 14 Load      ; load
  258.     gadhelp 'Will load the selected files if they are guis'
  259.     gadid 60
  260.     lvuse Gui4Cli.gc 10
  261.     lvmulti first
  262.     while $guivar > ''
  263.         if $guivar H= G4C
  264.            guiload $guivar
  265.         endif    
  266.         lvmulti next
  267.     endwhile
  268.     lvdir none
  269.  
  270. XBUTTON 117 42 20 14 "P"
  271.     gadhelp 'CD to Parent dir'
  272.     gadid 60
  273.     lvuse Gui4Cli.gc 10
  274.     lvdir parent
  275.     oldguidir = $$lv.dir
  276.     setwintitle gui4cli.gc '$oldguidir'
  277.  
  278. XBUTTON 138 42 20 14 "D"
  279.     gadhelp 'Show Volumes list'
  280.     gadid 60
  281.     lvuse Gui4Cli.gc 10
  282.     lvdir disks
  283.     oldguidir = ''
  284.     setwintitle gui4cli.gc 'Devices'
  285.  
  286. XBUTTON 171 42 20 14 "G"
  287.     gadhelp 'Shortcut to GUIs:'
  288.     gadid 60
  289.     lvuse Gui4Cli.gc 10
  290.     lvdir #Guis:
  291.     oldguidir = GUIs:
  292.     setwintitle gui4cli.gc 'GUIs:'
  293.  
  294. XBUTTON 117 27 20 14 "A"  ; also shown in gui mode
  295.     gadhelp 'Select all items'
  296.     gadid 60
  297.     lvuse Gui4Cli.gc 10
  298.     lvdir all
  299.  
  300. XBUTTON 138 27 20 14 "N"
  301.     gadhelp 'Unselect all items'
  302.     gadid 60
  303.     lvuse Gui4Cli.gc 10
  304.     lvdir none
  305.  
  306. ; ---------------- Favourite Loading dirs
  307.  
  308. XBUTTON 192 27 58 14 "Fav"
  309.     gadid 70
  310.     gadhelp 'Switches to and from Favourites mode'
  311.     lvuse gui4cli.gc 10
  312.     if $mode = FAV
  313.        setgad gui4cli.gc 71 on
  314.        setgad gui4cli.gc 60/63 on
  315.        setgad gui4cli.gc 72 off
  316.        lvhelp = 'Choose guis to load'
  317.        lvmode DIR
  318.        lvdir #$oldguidir
  319.        mode = LOAD
  320.     else
  321.        setgad gui4cli.gc 71 off
  322.        setgad gui4cli.gc 60/63 off
  323.        setgad gui4cli.gc 72 on
  324.        lvhelp = 'Double click on a directory, or hit FAV again to cancel'
  325.        lvmode MULTI
  326.        lvchange guis:tools/fav/G4C.fav
  327.        lvsort asc
  328.        mode = FAV
  329.     endif
  330.  
  331. XBUTTON 252 27 29 14 "+"
  332.     gadid 71
  333.     gadhelp 'Adds the current dir the Listview is at, to your favourites'
  334.     lvuse gui4cli.gc 10
  335.     append guis:tools/fav/g4c.fav '\n$$lv.dir'
  336.  
  337. XBUTTON 252 42 29 14 "-"
  338.     gadid 72
  339.     gadhelp 'Deletes selected favourite entries'
  340.     lvuse gui4cli.gc 10
  341.     lvmulti first
  342.     while $guivar > ''
  343.        lvdel -1
  344.        lvmulti first
  345.     endwhile
  346.  
  347. XBUTTON 192 42 58 14 "Save"
  348.     gadid 72
  349.     gadhelp 'Save favourites to GUIs:tools/fav/G4C.fav'
  350.     lvuse gui4cli